#!/usr/bin/env python

import sys
import os

try:
   import pynotify
   import gtk
   mod = "notify";
except ImportError:
   mod = "no";
#   try:
#      import growl
#      mod = "growl";
#   except ImportError:
#      mod = "no";

class notify:

   notify = None;

   def __init__(self):
      if mod == "growl":
         self.notify = self.growlNotify;
      elif mod == "notify":
         pynotify.init('blendit' + str(os.getpid()));
         self.notify = self.libNotify;
      else:
         self.notify = self.doNothing;     
      
   def doNothing(self,type,title,message):
      pass;

   def libNotify(self,img,title,message):
      #print 'about to notify', img,title, message;
      n = pynotify.Notification(message);
      buf = gtk.gdk.pixbuf_new_from_file(img);
      n.set_icon_from_pixbuf(buf);
      n.set_urgency(pynotify.URGENCY_LOW);
      n.set_timeout(4000);
      n.show();